#ifndef INPUTSYSTEM_H
#define INPUTSYSTEM_H
#include "KeyboardHandler.h"
#include "KeyboardInput.h"
#include "MouseHandler.h"
#include "MouseInput.h"
#include "StompedReality/Core.h"
#include "StompedReality/Core/GameAccess.h"
namespace StompedReality
{
namespace Input
{
/*!
 * \author	Stefan Kazalski
 *
 * \brief	Input system.
 *
 *    Manages mouse and keyboard.
 */
class DLL_EXPORT InputSystem :
  public StompedReality::GameAccess
{
 private:

  KeyboardInput* m_Keyboard;
  KeyboardHandler* m_KeyboardHandler;
  MouseInput* m_Mouse;
  MouseHandler* m_MouseHandler;

 public:

  /*!
   * \brief		Constructor.
   */
  InputSystem( );

  /*!
   * \brief		Destructor.
   */
  virtual ~InputSystem( );

  /*!
   * \brief		Parses the render systems properties.
   *
   * \param		root	The json root.
   *
   * \return	True if success otherwise false.
   */
  bool ParseConfig ( JsonPTR root );

 public:

  /*!
   * \brief  Updates the input.
   */
  void HandleInput( );

  /*!
   * \brief		Keyboard handler getter.
   */
  KeyboardHandler* GetKeyboardHandler( );

  /*!
   * \brief		Is key down check.
   *
   * \param		key  the key
   * \return	True if key is down otherwise false.
   */
  bool IsKeyDown ( const int key );

  /*!
   * \brief		Is key pressed check.
   *
   * \param		key  the key
   * \return	True if key is pressed otherwise false.
   */
  bool IsKeyPressed ( const int key );

  /*!
   * \brief		Is key up check.
   *
   * \param		key  the key
   * \return	True if key is up otherwise false.
   */
  bool IsKeyUp ( const int key );

  /*!
   * \brief		Current mouse position.
   *
   * \return	The mouse position.
   */
  StompedReality::Math::Vector2 GetMousePosition( );

  /*!
   * \brief		Current mouse position delta.
   *
   * \return	The mouse position delta.
   */
  StompedReality::Math::Vector2 GetMouseDelta( );

  /*!
   * \brief		Is left mouse button down.
   *
   * \return	True if left mouse button is down otherwise false.
   */
  bool IsLeftButtonDown( );

  /*!
   * \brief		Is left mouse button pressed.
   *
   * \return	True if left mouse button is pressed otherwise false.
   */
  bool IsLeftButtonPressed( );

  /*!
   * \brief		Is left mouse button up.
   *
   * \return	True if left mouse button is up otherwise false.
   */
  bool IsLeftButtonUp( );

  /*!
   * \brief		Is right mouse button down.
   *
   * \return	True if right mouse button is down otherwise false.
   */
  bool IsRightButtonDown( );

  /*!
   * \brief		Is right mouse button pressed.
   *
   * \return	True if right mouse button is pressed otherwise false.
   */
  bool IsRightButtonPressed( );

  /*!
   * \brief		Is right mouse button up.
   *
   * \return	True if right mouse button is up otherwise false.
   */
  bool IsRightButtonUp( );
};

}
}
#endif // INPUTSYSTEM_H
